mod sys_action;

use std::time::Duration;
use chrono::{ Local};
use sea_orm::{ActiveModelTrait, ActiveValue, ConnectOptions, Database, DatabaseConnection, IntoActiveModel};

use entity::user::Entity as UserDao;
use entity::user::ActiveModel as UserModel;
use entity::user::Model as Model;

fn main() {
    let mut opt = ConnectOptions::new("mysql://root:lzw719@127.0.0.1:3307/seaorm");
    opt.max_connections(100)
        .min_connections(5)
        .connect_timeout(Duration::from_secs(8))
        .acquire_timeout(Duration::from_secs(8))
        .idle_timeout(Duration::from_secs(8))
        .max_lifetime(Duration::from_secs(8))
        .sqlx_logging(true)
        .sqlx_logging_level(log::LevelFilter::Info)
        .set_schema_search_path("my_schema"); // Setting default PostgreSQL schema

    // let db = Database::connect(opt)?;

    // let entity::sys_action::Entity as actionDao;
    // let option = actionDao::find_by_id("2c92808375aac04b0175f989e64d0384")
    //     .one(&db).await.unwrap();
    // match option {
    //     Some(action) => {
    //         println!("action: {}", action);
    //     }
    //     None => {
    //         println!("action not found");
    //     }
    // }

}